package com.zhuge_new.Adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhuge_new.R;
import com.zhuge_new.bean.AnearngsBean;
import com.zhuge_new.untils.NumberUtil;

import java.util.List;

/**
 * Created by lenovo on 2018-09-29.
 */

public class AnearngsAdapter extends BaseQuickAdapter<AnearngsBean.ObjectBean,BaseViewHolder> {

    private Context context;
    private AnearngsBean anearngsBean;
    public AnearngsAdapter(Context context, AnearngsBean anearngsBean) {
        super(R.layout.item_anearngs,anearngsBean.getObject());
        this.context=context;
        this.anearngsBean=anearngsBean;
    }

    @Override
    public int getItemCount() {
        return anearngsBean.getObject().size()+getHeaderLayoutCount();
    }

    @Override
    protected void convert(BaseViewHolder helper, AnearngsBean.ObjectBean item) {
        helper.setText(R.id.anear_item_type,item.getProfitTypeName());
        helper.setText(R.id.anear_item_data,item.getCreateDate());
        String money= NumberUtil.saveRound(item.getProfitSum(),3);
        helper.setText(R.id.anear_item_money,"+"+money);
    }

}
